<?php
declare (strict_types=1);

namespace app\common\model;

class ProductCate extends Base
{
    public function children(): object
    {
        return $this->hasMany(ProductCate::class, 'pid')
            ->with('children');
    }

    public static function getCate($id = 0): object
    {
        return parent::field("id,icon,title")->where(['pid' => $id, 'status' => 1])
            ->order('sort desc')->select();
    }
}